import { createStore } from 'vuex'
import { ref } from 'vue'
import { getCart } from '@/service/cart'

const store = createStore({
    state () {
        return {
            count: ref(0)
        }
    },
    mutations: {
        updateCart (state) {
            getCart().then(res => {
                console.log(res);
                state.count = res.data.length
            })
        }
    }
})

export default store